import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

// 第一个参数传入的是自定义指令的名字 
Vue.directive('back',{
  bind:(el,binding)=>{
    console.log(binding.value);
     el.style.background = binding.value[0];
     el.style.color = binding.value[1];
  }
})


Vue.directive("slice", {
  bind(el, bindings, vnode) {
        // vnode.context 实例化出来的vue的对象
      var context = vnode.context;
      console.log(context);
      console.log(bindings);
      el.value = context[bindings.expression];
      el.oninput = e => {
        var value = e.target.value;
        context[bindings.expression] = value;
    }
  },
  // update(el, bindings, vnode) {},
  // inserted(el, bindings, vnode) {
  //     el.focus();
  // }
})


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
